package com.zntg.schedule.roleScheduledTask;
import com.zntg.utils.http.HttpRequestUtil;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class RoleScheduledTask {
    @Value("${template.targetPath}")
    String targetPath;
    @Value("${template.renamePath}")
    String renamePath;
    @Value("${spring.profiles.active}")
    String active;
    private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(RoleScheduledTask.class);
    /**
     * 每隔5秒执行, 单位：ms。
     */
     @Scheduled(cron = "0 0 5 * * ?")   //每天凌晨1点执行
  /*  @Scheduled(cron = "0 0/1 * * * ?")  */ //每1分钟
   /*@Scheduled(fixedRate = 50000000)*/
    public void run() {
            try {
                if (!HttpRequestUtil.isRole()){
                    //无权限，终止程序
                    System.out.println("暂无权限...............................................");
                    System.exit(0);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {

            }

    }
}

